//
//  SWSerial.h
//  SWSerialPortTool
//
//  Created by mt-007 on 2021/4/10.
//

#ifndef SWSerial_h
#define SWSerial_h

#import "./../SWImportLabary.h"

@interface SWSerial : NSObject{
    NSString *comNameFromDEV;
    bool _isOpen;
    bool _isConfig;
    int _fd;
    int _baudRate;
    int _dateBit;
    char _checkParity;
    int _stopBit;
}

- (int)serialConfig:(int)fd
        andBaudRate:(int)baudRate
         andDataBit:(int)dataBit
     andCheckParity:(char)checkParity
         andStopBit:(int)stopBit;

- (int)serialOpen:(NSString *)device;
- (int)serialClose:(int)fd;

- (ssize_t)serialRead:(int)fd andBuff:(void*)buf andBuffLength:(size_t)len;
- (ssize_t)serialWrite:(int)fd andBuff:(void*)buf andBuffLength:(size_t)len;

- (NSDictionary *)returnSerialStatus;
- (NSString *)returnSerialStatusByNSString;

@end

#endif /* SWSerial_h */
